package com.mainworks.commons.utils;

import java.text.SimpleDateFormat;

public class StringCustomUtils {
    public static final SimpleDateFormat date_minute =new SimpleDateFormat("yyyy-MM-dd HH:mm");
    public static final SimpleDateFormat DATETIME =new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    public static final SimpleDateFormat datetime =new SimpleDateFormat("yyyyMMddHHmmss");
    public static final SimpleDateFormat DATE =new SimpleDateFormat("yyyy-MM-dd");
    public static final SimpleDateFormat datetime_millisecond =new SimpleDateFormat("yyyyMMddHHmmssSSS");

    /**
     * 判定字符串是否是非空字符串
     * @param content
     * @return true--> 非空字符串 false --> 空字符串
     */
    public static boolean isNotEmpty(String content){
        if(content ==null){
            return false;
        }else if ("".equals(content.trim())){
            return false;
        }else if ("null".equals(content.trim())){
            return false;
        }else if ("undefined".equals(content.trim())){
            return false;
        }
        return true;
    }
    /**
     * 判定字符串是否是非空字符串
     * @param content
     * @return true--> 非空字符串 false --> 空字符串
     */
    public static boolean isNotNull(String content){
        if(content ==null){
            return false;
        }else if ("".equals(content.trim())){
            return false;
        }else if ("null".equals(content.trim())){
            return false;
        }else if ("undefined".equals(content.trim())){
            return false;
        }
        return true;
    }

    public static boolean isNull(String content) {
        if(content == null){
            return true;
        }else if ("".equals(content.trim())){
            return true;
        }else if ("null".equals(content.trim())){
            return true;
        }else if ("undefined".equals(content.trim())){
            return true;
        }
        return false;
    }
    public static String nullHandle(String content){
        if (isNull(content)){
            content = "";
        }
        return content.trim();
    }
}
